Combination in mod P
$ _nC_k = C(n, k) = \binom{n}{k} = \frac{n!}{k!(n-k)!}
for large numbers n and k.
Assume that the value in mod P is good.
After taking the remainder, no ordinary division can be performed.
For single-shot calculations, create an inverse original in logarithmic order.
If you want to calculate a large number of calculations, you can create an inverse table, and each calculation will be on the order of a constant. ---
This page is auto-translated from /nishio/mod Pでの組み合わせ. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.